"""
URL configuration for startdjango project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.core.checks import database
from django.http import HttpResponse
from django.urls import path, include, reverse

import book.views
import movie
from movie import views

import database_demo.views


def index(request):
    print(reverse("book_detail_path",kwargs={"book_id":1}))
    print(reverse("movie:movie_list"))
    print(reverse("book_detail")+"?id=1&name=123")
    return HttpResponse("Hello, world.")

urlpatterns = [
    path('admin/', admin.site.urls),

    # path("",index,name="index"),
    # path('s', index),

    path('',views.index,name='index'),
    path('book/',book.views.book_detail_query_string,name="book_detail"),   #http://127.0.0.1:8000/book/?id=2
    path('book/<slug:book_id>',book.views.book_detail_path,name="book_detail_path"),   #str int uuid slug path
    path("movie/", include('movie.urls')),
    path('baidu/',movie.views.baidu,name="baidu"),
    path('info/',movie.views.info,name="info"),
    path('database/',database_demo.views.index,name="database"),
    path("database/add",database_demo.views.add_book,name="add_book"),
    path("database/query",database_demo.views.query_book,name="query_book"),
    path("article/", include('article.urls')),
    path("front/", include('front.urls')),
    path("cookie_session/", include('cookie_cession.urls')),
]
